import request from '@/utils/request'

//获取一级分类
export const reqCategory =(num,id='')=>{
    switch(num){
        case 1:
            return request({
                url:"/admin/product/getCategory1",
                method:'get'
            })
        case 2:
            return request({
                url:`/admin/product/getCategory2/${id}`,
                method:'get'
            })
        case 3:
            return request({
                url:`/admin/product/getCategory3/${id}`,
                method:'get'
            })
    }
}

export const reqManage=(category1Id,category2Id,category3Id)=>{
    return request({
        url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
        method:'get'
    })
}

export const reqSaveAttrInfo= (data)=>{
    return request({
        url:'/admin/product/saveAttrInfo',
        method:'post',
        data
    })
}
/*
    {
    "   attrName": "属性名",
        "attrValueList": [ 属性值数组
                    {
            "attrId": 0, 属性的id
            "valueName": "属性值"
            }
        ],
    "categoryId": 0, 数据id是
    "categoryLevel": 3, 第三层 
}
*/